package com.kumi.blog.user.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kumi.blog.user.bean.Encrypted;
import com.kumi.blog.user.service.EncryptedService;
import com.kumi.common.utils.PageUtils;
import com.kumi.common.utils.R;



/**
 * 密保问题表
 *
 * @author kumi
 * @email 1971240051@qq.com
 * @date 2022-06-04 03:21:45
 */
@RestController
@RequestMapping("user/encrypted")
public class EncryptedController {
    @Autowired
    private EncryptedService encryptedService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("user:encrypted:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = encryptedService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{eId}")
    //@RequiresPermissions("user:encrypted:info")
    public R info(@PathVariable("eId") Integer eId){
		Encrypted encrypted = encryptedService.getById(eId);

        return R.ok().put("encrypted", encrypted);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("user:encrypted:save")
    public R save(@RequestBody Encrypted encrypted){
		encryptedService.save(encrypted);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("user:encrypted:update")
    public R update(@RequestBody Encrypted encrypted){
		encryptedService.updateById(encrypted);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("user:encrypted:delete")
    public R delete(@RequestBody Integer[] eIds){
		encryptedService.removeByIds(Arrays.asList(eIds));

        return R.ok();
    }

}
